﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace FXC.SL.CS.Modal
{
    public class DataWindowItem : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private DateTime _dateTime;
        private double _open;
        private double _close;
        private double _high;
        private double _low;
        private int _volume;

        public double Open
        {
            get
            {
                return _open;
            }
            set
            {
                _open = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Open"));
                }
            }
        }

        public double Close
        {
            get
            {
                return _close;
            }
            set
            {
                _close = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Close"));
                }
            }
        }

        public double High
        {
            get
            {
                return _high;
            }
            set
            {
                _high = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("High"));
                }
            }
        }

        public double Low
        {
            get
            {
                return _low;
            }
            set
            {
                _low = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Low"));
                }
            }
        }

        public int Volume
        {
            get
            {
                return _volume;
            }
            set
            {
                _volume = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Volume"));
                }
            }
        }

        public DateTime DateTimeData
        {
            set
            {
                _dateTime = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Date"));
                    PropertyChanged(this, new PropertyChangedEventArgs("Time"));
                }
            }
        }

        public string Date
        {
            get
            {
                return _dateTime.ToShortDateString();
            }
        }

        public string Time
        {
            get
            {
                return _dateTime.ToShortTimeString();
            }
        }

    }
}
